import {
	defineStore
} from "pinia"
import {
	getCommon,
	getWisdom,
	getDoorwhere
} from "../api/serverData"
export const useServerStore = defineStore("server", {
	state: () => ({
		common: [],
		wisdom: [],
		whereDoor: [],
		flagshow: false
	}),
	actions: {
		// 常用服务
		async getServerCommon() {
			try {
				const res = await getCommon()
				this.common = res.data
			} catch (error) {
				console.log(error)
			}
		},
		// 智慧社区
		async getServerWisdom() {
			try {
				const res = await getWisdom()
				this.wisdom = res.data
			} catch (error) {
				console.log(error)
			}
		},
		//手机开门
		async getDoorwheres() {
			try {
				const res = await getDoorwhere()
				this.whereDoor = res.data
			} catch (err) {
				console.log(err)
			}
		}
	}
})